#include<stdio.h>
#include<stdlib.h>
int a[8];
char *day[]
={"","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"};
int main()
{
    int i,t,j;
    a[4]=6;
    for(i=1;i<3;i++)
    {
        a[i]=2;
        if(!a[i+3]) a[i+3]=7;
        else {a[i]=0;continue;}
        for(t=1;t<=3;t++)
        {
            if(!a[t]) a[t]=5;
            else continue;
            if(!a[t+2]) a[t+2]=4;
            else {a[t]=0;continue;}
            for(j=5;j<7;j++)
        {
            if(!a[j]) a[j]=3;
            else continue;
            if(!a[j+1]) a[j+1]=1;
            else {a[j]=0;continue;}
            for(i=1;i<=7;i++)
            printf("Doctor %c is on duty %s.\n",'A'+a[i]-1,day[i]);
            exit (0);
        }
        }
    }
}